// Author	: Ahmed Yasser
// Date		: 20/12/2014
// Desc		: Include difinitons of string data type

#include "pu_platform_atomic.h"

namespace PUGE
{
	namespace Platform
	{
		namespace Atomic
		{
			/*
				CLASS	: String
				DESCR	: Declare a string data type that can be used in the game engine
			*/
			class String
			{
			private:
				
				// the string buffer
				char* pStrData;

				// the string size
				UInt32 strSize;

				// the string capacity
				UInt32 strCapacity;

			public:

				/*
					Method	: String()
					DESCR	: Default Constructor that initialize the String with nullptr buffer
				*/
				String();

				/*
					Method	: String(UInt32 initialSize)
					PARAMS	: initialSize : the initial size of the string buffer
					DESCR	: create an empty buffer that can hold initialSize capcity
				*/
				String(UInt32 initialSize);

				/*
					Method	: String(const char* buffer, UInt32 bufferLength)
					PARAMS	: buffer : the initial buffer that feeds the string
							: bufferLength : the length of the buffer to be holded inside the
											 the String internal buffer
					DESCR	: creates a String object contains the buffer supplied
				*/
				String(const char* buffer, UInt32 bufferLength);

				/*
					Method	: String(const String& strSrc)
					PARAMS	: strSrc : The source String object
					DESCR	: Copy constructor that copies an instance of the String object
				*/
				String(const String& strSrc);

				/*
				Method	: String(String&& strSrc)
				PARAMS	: strSrc : The source String object
				DESCR	: Move constructor that transform the data to current object
				*/
				String(String&& strSrc);

				/*
					Method	: ~String()
					DESCR	: String destructor
				*/
				~String();

			public:
				const char* getBuffer();
				UInt32 getLength();

			public:
				void clear();
				String reverse();
				Int32 find(Char chTarget);
				Int32 find(String& target);
				Int32 reverseFind(Char chTarget);
				Int32 reverseFind(String& target);
				String subString(UInt32 start, UInt32 length = 0);
			};
		}
	}
}